package com.dg.gaming.tictactoe.client;

import com.dg.gaming.client.ClientConnectionThread;
import com.dg.gaming.api.common.*;
import com.dg.gaming.api.common.util.*;
import com.dg.gaming.client.TableConnectionThread;
import com.dg.gaming.api.common.playerstate.*;

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright (c) 2009</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */
public class TestTable {
    public static void main(String[] args) {
        ClientConnectionThread conn = new ClientConnectionThread(null, 1, null);
        Game game = new Game("1", 2, 2);
        game.setUserList(new UserList());
        User cu = new User("1", 1, 0, 0, 0, 0, 0);
        game.getUserList().addUser(cu);
        game.getUserList().addUser(new User("2", 2, 0, 0, 0, 0, 0));
        game.setTableList(new TableList());
        Table tbl = game.getTableList().addTable(cu, true,
                                                 new DGPropertyHash());
        tbl.addPlayer(game.getUserList().getUser(2));
        conn.setGame(game);
        TableConnectionThread tblcon = new TableConnectionThread(conn,
                tbl.getTableNum());

        TicTacToeTableFrame cf = new TicTacToeTableFrame(tblcon);
        tbl.getPlayerList().getPlayer(1L).setSeatNum(0);
        tbl.getPlayerList().getPlayer(2L).setSeatNum(1);
        tbl.getPlayerList().getPlayer(1L).setState(new PlayerStateGameStarted());
        tbl.getPlayerList().getPlayer(2L).setState(new PlayerStateGameStarted());
        tbl.getPlayerList().setCurrentPlayer(1L);
//        tbl.getPlayerList().getPlayer(1L).start();
//        tbl.getPlayerList().getPlayer(2L).start();

        cf.update(tbl.getPlayerList(),cf);
//        tbl.getPlayerList().getPlayer(1L).start();
    }
}
